import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';

@Entity('member_log')
export class MemberLog {
  @PrimaryGeneratedColumn({
    name: 'log_id',
    type: 'int',
    comment: '日志id',
  })
  logId: number;

  @Column({
    name: 'log_type',
    type: 'tinyint',
    default: 2,
    comment: '日志类型：0注册1登录2操作3退出',
  })
  logType: number;

  @Column({
    name: 'member_id',
    type: 'int',
    nullable: false,
    default: 0,
    comment: '会员id',
  })
  memberId: number;

  @Column({
    name: 'api_id',
    type: 'int',
    nullable: false,
    default: 0,
    comment: '接口id',
  })
  apiId: number;

  @Column({
    name: 'request_method',
    type: 'varchar',
    length: 16,
    default: '',
    comment: '请求方式',
  })
  requestMethod: string;

  @Column({
    name: 'request_url',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '请求URL',
  })
  requestUrl: string;

  @Column({
    name: 'request_ip',
    type: 'varchar',
    length: 128,
    default: '',
    comment: '请求IP',
  })
  requestIp: string;

  @Column({
    name: 'request_country',
    type: 'varchar',
    length: 127,
    default: '',
    comment: '请求国家',
  })
  requestCountry: string;

  @Column({
    name: 'request_province',
    type: 'varchar',
    length: 127,
    default: '',
    comment: '请求省份',
  })
  requestProvince: string;

  @Column({
    name: 'request_city',
    type: 'varchar',
    length: 127,
    default: '',
    comment: '请求城市',
  })
  requestCity: string;

  @Column({
    name: 'request_area',
    type: 'varchar',
    length: 127,
    default: '',
    comment: '请求区县',
  })
  requestArea: string;

  @Column({
    name: 'request_region',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '请求地区',
  })
  requestRegion: string;

  @Column({
    name: 'request_isp',
    type: 'varchar',
    length: 100,
    default: '',
    comment: '请求ISP',
  })
  requestIsp: string;

  @Column({
    name: 'request_param',
    type: 'mediumtext',
    nullable: true,
    comment: '请求参数',
  })
  requestParam: string;

  @Column({
    name: 'response_code',
    type: 'varchar',
    length: 11,
    default: '',
    comment: '返回码',
  })
  responseCode: string;

  @Column({
    name: 'response_msg',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '返回描述',
  })
  responseMsg: string;

  @Column({
    name: 'user_agent',
    type: 'varchar',
    length: 1024,
    default: '',
    comment: '用户代理',
  })
  userAgent: string;

  @Column({
    name: 'platform',
    type: 'tinyint',
    width: 2,
    default: 0,
    comment: '平台',
  })
  platform: number;

  @Column({
    name: 'application',
    type: 'tinyint',
    width: 2,
    default: 0,
    comment: '应用',
  })
  application: number;

  @Column({
    name: 'is_delete',
    type: 'tinyint',
    default: 0,
    comment: '是否删除，1是0否',
  })
  isDelete: number;

  @Column({
    name: 'create_uid',
    type: 'int',
    default: 0,
    comment: '添加用户id',
  })
  createUid: number;

  @Column({
    name: 'update_uid',
    type: 'int',
    default: 0,
    comment: '修改用户id',
  })
  updateUid: number;

  @Column({
    name: 'delete_uid',
    type: 'int',
    default: 0,
    comment: '删除用户id',
  })
  deleteUid: number;

  @Column({
    name: 'create_time',
    type: 'datetime',
    nullable: true,
    comment: '添加时间',
  })
  createTime: Date;

  @Column({
    name: 'update_time',
    type: 'datetime',
    nullable: true,
    comment: '修改时间',
  })
  updateTime: Date;

  @Column({
    name: 'delete_time',
    type: 'datetime',
    nullable: true,
    comment: '删除时间',
  })
  deleteTime: Date;
}